<template>
	<view :style="Theme">
		<uni-nav-bar leftIcon="arrowleft" :statusBar="true" :fixed="true" :title="detailInfo.title" />
		<view class="main">
			<view class="boxWrap">
				<view class="top flex">
					<view class="top_c">{{detailInfo.title}}</view>
				</view>
				<view class="con2">发布时间:{{detailInfo.addTime}}</view>
				<view class="con3" v-html="detailInfo.content"></view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				detailInfo:{}
			}
		},
		onLoad(option) {
			console.log('前一个页面参数')
			console.log(option)
			this.id = option.id
		},
		onShow() {
			// 获取公告详情
			this.getNoticeDetail()
		},
		methods: {
			getNoticeDetail() {
				this.sjuRequest("/wx/notice/getNoticeById", 'POST', {
					id: this.id,
					page: 1,
					limit: 100
				}).then(res => {
					console.log(res)
					// img标签添加style属性：max-width:100%;height:auto
					let newContent = res.data.content.replace(/\<img/gi,
						'<img style="max-width:100%;height:auto;display:block;margin-top:0;margin-bottom:0;"'
					)
					this.detailInfo = res.data
					this.detailInfo.content = newContent
					
				})
			},
		},

	}
</script>

<style lang="scss">
	.boxWrap {
		padding: 20rpx;
		margin-bottom: 20rpx;
	}

	.top {
		width: 100%;
		height: auto;
		align-items: center;
	}

	.top_img {
		width: 40rpx;
		height: auto;
	}

	.top_c {
		font-size: 32rpx;
		font-weight: bold;
	}

	.con2 {
		margin: 10rpx 0;
		color: #666;
		font-size: 24rpx;
		margin-bottom: 20rpx;
	}

	.con3 {
		line-height: 36rpx;
		font-size: 28rpx;
		height: auto;
	}
	img{
		width: 100%;
		display: block;
		height: auto;
	}
</style>